package controllers;

import java.util.ArrayList;

import controllers.rpcgame.RPCController;

/**
 * Implemented as a singleton.
 * 
 */

public class GameController {

	private static GameController instance = null;

	private GameController() {
	}

	public static GameController getInstance() {
		if (instance == null) {
			instance = new GameController();
		}
		return instance;
	}

	// methods

	/**
	 * @param gameName
	 *            - in future, with more games, this method should be
	 *            implemented with suitable design pattern, but not with "if"
	 *            statement. Meanwhile, the parameter is ignored.
	 */
	public boolean startNewGame(String username1, String username2, int iid1,
			int iid2, String gameName) {
		return RPCController.getInstance().addGame(username1, username2, iid1,
				iid2);
	}

	public boolean finishNewGame(String username1, String username2, int iid1,
			int iid2) {
		// TODO
		return false;
	}

	/**
	 * The sincronious method. It only only notice to player that his turn was made.
	 * @param username
	 * @param turn
	 * @param gameName
	 *            - in future, with more games, this method should be
	 *            implemented with suitable design pattern, but not with "if"
	 *            statement. Meanwhile, the parameter is ignored.
	 * @return which turn was made.
	 */
	public String makeTurn(String username, String turn, String gameName) {
		
		return RPCController.getInstance().makeTurn(username, turn);
	}

}
